class TFCMAltFire extends TFProjectileFire;

event ModeDoFire()
{
    if (!AllowFire() || Instigator.bIsCrouched)
        return;

    if (MaxHoldTime > 0.0)
        HoldTime = FMin(HoldTime, MaxHoldTime);

    // server
    if (Weapon.Role == ROLE_Authority)
    {
        Weapon.ConsumeAmmo(ThisModeNum, Load);
        DoFireEffect();
        if ( (Instigator == None) || (Instigator.Controller == None) )
			return;
        if ( AIController(Instigator.Controller) != None )
            AIController(Instigator.Controller).WeaponFireAgain(BotRefireRate, true);
        Instigator.SpawnTime = -100000;
    }

    // client
    if (Instigator.IsLocallyControlled())
    {
        ShakeView();
        PlayFiring();
        FlashMuzzleFlash();
        StartMuzzleSmoke();
    }
    else // server
    {
        ServerPlayFiring();
    }

    Weapon.IncrementFlashCount(ThisModeNum);

    // set the next firing time. must be careful here so client and server do not get out of sync
    if (bFireOnRelease)
    {
        if (bIsFiring)
            NextFireTime += MaxHoldTime + FireRate;
        else
            NextFireTime = Level.TimeSeconds + FireRate;
    }
    else
    {
        NextFireTime += FireRate;
        NextFireTime = FMax(NextFireTime, Level.TimeSeconds);
    }

    Load = AmmoPerFire;
    HoldTime = 0;

    if (Instigator.PendingWeapon != Weapon && Instigator.PendingWeapon != None)
    {
        bIsFiring = false;
        Weapon.PutDown();
    }
}

simulated function bool AllowFire()
{
    return (Instigator.bIsCrouched || (Weapon.AmmoAmount(ThisModeNum) >= AmmoPerFire));
}

defaultproperties
{
     ProjSpawnOffset=(X=23.000000,Y=10.000000,Z=-15.000000)
     bSplashDamage=True
     bRecommendSplashDamage=True
     bTossed=True
     bWaitForRelease=True
     bModeExclusive=False
     TransientSoundVolume=1.250000
     FireAnim="AltFire"
     FireLoopAnim=
     FireEndAnim=
     FireSound=Sound'TFMedia.Commando.TFCMAltFire'
     FireForce="AssaultRifleAltFire"
     FireRate=0.100000
     AmmoClass=Class'taskforces.TFCMAltAmmo'
     AmmoPerFire=1
     ShakeRotMag=(X=40.000000,Y=10.000000)
     ShakeRotRate=(X=1000.000000,Y=1000.000000)
     ShakeRotTime=2.000000
     ShakeOffsetMag=(X=-80.000000)
     ShakeOffsetRate=(X=-1500.000000)
     ShakeOffsetTime=0.900000
     ProjectileClass=Class'taskforces.TFCMFlashBang'
     BotRefireRate=0.250000
     Spread=50.000000
     SpreadStyle=SS_Random
}
